package com.hj.system.base.config;

import freemarker.template.Configuration;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;

@Component
public class ShiroTagFreeMarkerConfigurer implements InitializingBean {
    @Autowired
    private Configuration configuration;
    @Autowired
    private FreeMarkerViewResolver freeMarkerViewResolver;

    @Override
    public void afterPropertiesSet() {
        configuration.setSharedVariable("shiro", new ShiroTagsCustomer());
        freeMarkerViewResolver.setRequestContextAttribute("context");
    }
}
